<template>
  <view class="book-success" :style="'padding-top:' + navHeight + 'px;'">
    <view class="success-info">
      <image class="success-logo" :src="successLogo"></image>
      <span v-if="!isFailed">支付成功</span>
      <span v-if="isFailed">支付失败</span>
      <view class="remind-info" v-if="!isFailed">
        <view>开启服务通知</view>
        <view>能更快提醒你服务状态~</view>
      </view>
    </view>
    <view class="button-list">
      <view v-if="!isFailed" class="background-orange" @click="toBookConsultant"
        >去预约顾问咨询</view
      >
      <view v-if="isFailed" class="background-orange" @click="goBack"
        >返回上一页</view
      >
      <view class="background-white" @click="gotoIndex">回到职途主页</view>
    </view>
  </view>
</template>

<script>
import { consultantInfo } from "@/api/modules/career";
import { addAppointment } from "@/api/index";

export default {
  components: {},
  data() {
    return {
      navHeight: getApp().globalData.navHeight,
      successLogo: this.$imgBase + "careerPath/bookSuccess.png",
      isFailed: true,
    };
  },
  onLoad(opt) {
    if (opt.isFailed == "true") {
      this.isFailed = true;
      this.successLogo = this.$imgBase + "careerPath/bookFailed.png";
    } else {
      this.isFailed = false;
    }
    console.log("this.isFiled", this.isFailed);
    // this.isFailed = true;
    // this.successLogo = this.$imgBase + "careerPath/bookFailed.png";
  },
  onShow() {},
  onHide() {},
  mounted() {},
  // 必须要在onReady生命周期，因为onLoad生命周期组件可能尚未创建完毕
  onReady() {},
  methods: {
    gotoIndex() {
      uni.reLaunch({
        url: "/pagesSub/userCenter/careerPathV2/index",
      });
    },
    toBookConsultant() {
      uni.navigateTo({
        url: "/pagesSub/userCenter/careerPathV2/components/BookConsultant",
      });
    },
    goBack() {
      uni.navigateBack({
        delta: 1, // 返回的页面数，这里设置为1表示返回上一页
      });
    },
  },
};
</script>

<style lang="scss" scoped>
$img-base-person: $img-base + "careerPath/";
.book-success {
  width: 100%;
  background-color: #ffffff;
  padding: 20vh 16rpx;
  height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: space-evenly;
  .success-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    .success-logo {
      width: 240rpx;
      height: 240rpx;
    }
    span {
      width: 169rpx;
      height: 40rpx;
      font-size: 40rpx;
      font-family: PingFang-SC, PingFang-SC;
      font-weight: bold;
      color: #222222;
      line-height: 40rpx;
      margin-top: 64rpx;
    }
    .remind-info {
      margin-top: 60rpx;
      view {
        width: 552rpx;
        /* height: 80rpx; */
        font-size: 28rpx;
        font-family: PingFangSC, PingFang SC;
        font-weight: 400;
        color: #333333;
        line-height: 40rpx;
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: center;
        margin-bottom: 10rpx;
      }
    }
  }
  .button-list {
    view {
      display: flex;
      flex-direction: row;
      align-items: center;
      justify-content: center;
      border-radius: 16rpx;
      height: 80rpx;
      font-size: 28rpx;
      font-family: PingFangSC, PingFang SC;
      font-weight: 500;
      margin-bottom: 32rpx;
    }
    .background-orange {
      background: #f75a3e;
      color: #ffffff;
    }
    .background-white {
      background: #ffffff;
      color: #f75a3e;
      border: 2rpx solid #f75a3e;
    }
  }
}
</style>
